﻿
app.factory("cursoService", function ($http) {
    var bUrl = "http://localhost:2142/api/";
    return {
        getListByFilter: function () {
            return $http.get(bUrl + "curso").then(function (r) {
                return r;
            });
        },
        create: function (data) {
            return $http.post(bUrl + "curso", data).then(function (r) {
                return r;
            });
        },
        "delete": function (CursoId) {
            return $http.delete(bUrl + "curso", { params: CursoId }).then(function (r) {
                return r;
            });
        },

        update: function (idx, data) {
            return $http({
                method: "PUT",
                url: bUrl + "curso/" + data.CursoId,
                data: data
            }).then(function (r) {
                return r;
            });
        },
    }
});

/*
'use strict';
app.factory('cursoService', ['$http', 'config', function ($http, config) {

    var _get = function () {
        return $http.get(config.baseMatriculadUrl + 'api/Curso').then(function (results) {
            return results;
        });
    };


    return {
        getList: _get,
    };

}]);*/